import React,{useEffect, useState} from 'react'
import {useDebounce} from './util'

 const Hello:React.FC=()=>{
    const [sex,setSex]=useState(1)
    const debounceVal=useDebounce(sex.toString(),1000)
    useEffect(()=>{
        return ()=>{
            console.log('sex 变化',sex)
        }
    },[sex])
    const handleClick=()=>{
        setSex(sex+1)
    }
     return (
         <div>
             <p>{debounceVal}</p>
            <p>{sex}</p>
            <button onClick={handleClick}>确定</button>
         </div>
     )
 }

 export default Hello